﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace Common.DataTypes
{
    public abstract class Item
    {
        #region CONSTANTES
        // ITEM CONSTANTS
        public const int INVALID = -1;
        public const int ASIN = 0;
        public const int DETAILPAGEURL = 1;
        public const int SALESRANK = 2;
        public const int SMALLIMAGE = 3;
        public const int MEDIUMIMAGE = 4;
        public const int LARGEIMAGE = 5;
        public const int MANUFACTURER = 6;
        public const int TITLE = 7;
        public const int LISTPRICE = 8;
        public const int PACKAGEDIMENSIONS = 9;
        public const int LABEL = 10;
        public const int STUDIO = 11;
        public const int BINDING = 12;
        public const int EAN = 13;
        
        // BOOK CONSTANTS
        public const int AUTHOR = 14;
        public const int ISBN = 15;
        public const int PUBLICATIONDATE = 16;
        public const int PUBLISHER = 17;
        public const int RELEASEDATE = 18;

        #endregion

        #region FIELDS
        public string Keyword { get; set; }
        public string Asin { get; set; }
        public string DetailPageUrl{ get; set; }
        public string SalesRank { get; set; }
        public string SmallImage{ get; set; }
        public string MediumImage { get; set; }
        public string LargeImage { get; set; }
        public string Manufacturer { get; set; }
        public string Title { get; set; }
        public ListPriceData ListPrice { get; set; }
        public string PackageDimensions{ get; set; }
        public string Label{ get; set; }
        public string Studio{ get; set; }
        public string Binding { get; set; }
        public string Ean { get; set; }
        #endregion
    }

    public class ListPriceData{
        public const int AMOUNT = 0;
        public const int FORMATTEDPRICE = 1;
        public const int CURRENCYCODE = 2;

        public static Dictionary<String, int> DicListPriceProperties = null;

        public string Amount  { get; set; }
        public string FormattedPrice  { get; set; }
        public string CurrencyCode  { get; set; }

        public ListPriceData()
        {
        }

        public ListPriceData(string amount, string formatted_price, string currency_code) {
            this.Amount = amount;
            this.FormattedPrice = formatted_price;
            this.CurrencyCode = currency_code;
        }

        public void AssignProperty(int property_type, string value) {
            switch (property_type)
            {
                case ListPriceData.AMOUNT:
                    this.Amount = value;
                    break;
                case ListPriceData.FORMATTEDPRICE:
                    this.FormattedPrice = value;
                    break;
                case ListPriceData.CURRENCYCODE:
                    this.CurrencyCode = value;
                    break;
            }
        }

        public static Dictionary<String, int> GetPropertiesDictionary() {
            if (DicListPriceProperties == null) {
                DicListPriceProperties = new Dictionary<string, int>();

                DicListPriceProperties.Add("amount", ListPriceData.AMOUNT);
                DicListPriceProperties.Add("formattedprice", ListPriceData.FORMATTEDPRICE);
                DicListPriceProperties.Add("currencycode", ListPriceData.CURRENCYCODE);
            }

            return (DicListPriceProperties);
        }
    }
}
